import http from "../request"
import { Basic } from "../types"
import { Shop } from '../types/Shop'
let commonUrl = '/ignore/user/cart'
export function listShopCar(userId: number) {
	return http<Shop.shopCarType[]>({
		url: commonUrl + `/all?userId=${userId}`,
		method: 'GET'
	})
}
/** 添加 */
export function addShopCar(data: { goodId: number, userId: number, url: string }) {
	return http<Basic>({
		url: commonUrl + '/add',
		method: 'POST',
		data
	})
}
/** 删除 */
export function delShopCar(userId: number, goodsId: number) {
	return http<Basic>({
		url: commonUrl + `/del?userId=${userId}&goodsId=${goodsId}`,
		method: 'DELETE'
	})
}
/** 添加商品数量 */
export function addShopNum(data: { userId: number, goodId: number }) {
	return http<Basic>({
		url: commonUrl + '/incr',
		method: 'POST',
		data
	})
}
/** 添减少商品数量 */
export function reduceShopNum(data: { userId: number, goodId: number }) {
	return http<Basic>({
		url: commonUrl + '/reduce',
		method: 'POST',
		data
	})
}
 
